Skip to content

Conversation

@ljanyst
Copy link

@ljanyst ljanyst commented Nov 10, 2025

Add support for EUI64 IPv6 addresses

Description

Needed to run as a server.

Test Steps

Checklist:

  • I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request.

Related Issue

Fixes #1150

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

ljanyst and others added 5 commits November 10, 2025 19:34
Previous behavior allowed for either randomizing the host part or
filling it with zeros. An IPv6 address with the host part set to all
zeros is reserved for router anycasts by RFC4291. Instead, we're
allowing the caller to either specify the host part of the address
or we randomize it if NULL.
@htibosch
Copy link
Contributor

Hi @ljanyst , thanks for this PR.

I am curious, what inspired you to add support for using EUI64 IPv6 addresses?
As I look at your code, it will seldomly be used, only in case a proposed address has a collision, ie. when bIPAddressInUse is true.

@ljanyst
Copy link
Author

ljanyst commented Nov 17, 2025

it will seldomly be used, only in case a proposed address has a collision

It is not the case at all. The state machine for router advertisements starts with bIPAddressInUse = pdTRUE_UNSIGNED. See: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/source/FreeRTOS_RA.c#L416

The reasoning for the feature is explained here: #1150

@htibosch
Copy link
Contributor

It is not the case at all. The state machine for router advertisements starts with bIPAddressInUse = pdTRUE_UNSIGNED.

Sorry, you are right. It is a splendid solution! I tested it and it works on my LAN with RA router.

The only "but" would be that we change the signature:

BaseType_t FreeRTOS_CreateIPv6Address( IPv6_Address_t * pxIPAddress,
                                       const IPv6_Address_t * pxPrefix,
                                       size_t uxPrefixLength,
+                                      const IPv6_Address_t * pxHost )
-                                      BaseType_t xDoRandom )

If the function is called with a 0 or a 1 for and xDoRandom, can we detect that?

Otherwise I like it, and it works well!
Thanks

@ljanyst
Copy link
Author

ljanyst commented Nov 21, 2025

I guess that depends on the compiler and verbosity settings. 0 is a valid value for a pointer, but 1 is extremely unlikely to be one in a hosted environment. This function was used in the code exactly once and I don't think it's likely to have been used by a external caller. On top, the previous interface actually did not make much sense. An IPv6 address with all zeros in the host part is reserved for router anycasts by RFC4291.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Support EUI-64 or similar for global unicast IPv6 addresses derived from RA

3 participants